package cheme.ProcessEditor.Parts.Streams;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.gef.EditPart;

import cheme.ProcessEditor.Figures.StreamFig;
import cheme.ProcessEditor.Figures.Util.ChemePolylineDecoration;
import cheme.ProcessModel.ProcessUnits.ITerminal;

public class DirectedStreamPart extends AbstractStreamPart
{
	ChemePolylineDecoration decorator;
	
	protected IFigure createFigure()
	{
		PolylineConnection connection = (PolylineConnection)super.createFigure();
		setFigure(connection);
		
		setTargetDecoration(new ChemePolylineDecoration(2, 12, 6));
		
		return connection;
	}
	
	/*
	 * This works, but I would like it to be part of the model.
	 */
//	@Override
//	public void setTarget(EditPart editPart)
//	{
//		super.setTarget(editPart);
//		
//		if(null == editPart)
//		{
//			return;
//		}
//
//		PolylineConnection connection = (PolylineConnection)getFigure();
//		
//		if(editPart.getModel() instanceof ITerminal)
//		{
//			/*
//			 * Terminal units do not have incoming streams decorated with arrows
//			 * or any other target decorator 
//			 */
//			connection.setTargetDecoration(null);
//		}
//		else
//		{
//			/*
//			 * Process units have incoming streams decorated if one is set for the object.
//			 */
//			connection.setTargetDecoration(getTargetDecoration());
//		}
//		
//		refresh();
//	}
}
